home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
setbit.asm
< prev
next >
Wrap
Assembly Source File
|
1985-06-03
|
1KB
|
54 lines
include c:sm8086.mac ;
longdata = 0 ;
longprog = 0 ;
dseg ;
eighty db 80 ; for multiply
bits db 80h ; bit table
db 40h ;
db 20h ;
db 10h ;
db 08h ;
db 04h ;
db 02h ;
db 01h ;
endds ;
pseg ;
public setbit,grinit ;
setbit proc near
x equ 4
push bp
mov bp,sp
push es
mov ax,0b800h ; color memory address
mov es,ax ; to extra seg register
mov al,[bp+x+2] ; row (y coordinate)
mov dx,[bp+x] ; col (x coordinate)
shr al,1 ; carry bit means it's in high chunk
jc odd ;
mov di,0 ; in low chunk
jmp comn ;
odd: mov di,2000h ; in high chunk
comn: mul eighty ;
add di,ax ; byte offset
mov si,dx ; column number
shr dx,1 ; shift off bottom 3 bits
shr dx,1 ;
shr dx,1 ;
add di,dx ; final byte offset
and si,7 ; SI has bit in byte
mov ah,es:[di] ; current byte contents
or ah,[bits+si] ; set desired bit
mov es:[di],ah ; store back
pop es ; restore old ES
pop bp ; and old BP
ret ; return
setbit endp ;
grinit proc near ;
mov ax,6 ; high res graphics
int 10h ;
ret ;
grinit endp ;
endps ;
end ;